﻿using DotUpdater.ActivationProcessors;

using Microsoft.ApplicationBlocks.Updater;

using NUnit.Framework;

namespace DotUpdater.Test
{
    [TestFixture]
    public class TestWaitForAppExit
    {
        [Test]
        public void TestWithoutStarting()
        {
            IActivationProcessor activator = new MockWaitForAppExitProcessorSimple();
            var task = new UpdaterTask("localBase", "remoteBase", new[] {"file1.txt"}, "code", new[] {"hash"});
            activator.Init(task);
            activator.Execute();
        }

        private class MockWaitForAppExitProcessorSimple : WaitForAppExitProcessorSimple
        {
            protected override void StartProcess(string paramName, string args)
            {
                Assert.AreEqual("0 msiexec /qb /i \\\"localBase\\file1.txt\\\" REINSTALL=ALL REINSTALLMODE=vomus", args);
            }

            protected override int CurrentPid { get { return 0; } }
            protected override void CheckFiles(string fullMsiName, string fullExeName) { }
        }
    }
}
